import badgeMix from '@/mixins/tabbar-badge.js'
import {
	mapState,
	mapMutations
} from 'vuex'

export default {
	data() {
		return {
			options: [{
				text: '删除', // 显示的文本内容
				style: {
					backgroundColor: '#C00000' // 按钮的背景颜色
				}
			}]
		};
	},
	computed: {
		...mapState('m_cart', ['cart'])
	},
	methods: {
		...mapMutations('m_cart', ['updateGoodsState', 'updateGoodsCount', 'removeGoodsById']),

		// 商品的勾选状态发生了变化
		radioChangeHandler(e) {
			this.updateGoodsState(e)
		},

		numChangeHandler(e) {
			this.updateGoodsCount(e)
		},

		swipeActionClickHandler(goods) {
			this.removeGoodsById(goods.goods_id)
		}
	},
	mixins: [badgeMix],
}
